package fivestar.util;
 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import fivestar.controller.service.AddressService;
import fivestar.controller.service.CityService;
import fivestar.controller.service.CountryService;
import fivestar.controller.service.GuestService;
import fivestar.controller.service.InvoiceService;
import fivestar.controller.service.ReservationService;
import fivestar.controller.service.StayService;
import fivestar.model.entity.Address;
import fivestar.model.entity.City;
import fivestar.model.entity.Guest;

public class Context {

    private static final String CONFIG_PATH = "applicationContext.xml";

    private static final ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_PATH);

    private static final GuestService serviceGuest = context.getBean("guestService", GuestService.class);
    private static final CountryService serviceCountry = context.getBean("countryService", CountryService.class);
    private static final CityService serviceCity = context.getBean("cityService", CityService.class);
    private static final AddressService serviceAddress = context.getBean("addressService", AddressService.class);
    private static final ReservationService serviceReservation = context.getBean("reservationService", ReservationService.class);
    private static final StayService serviceStay = context.getBean("stayService", StayService.class);
    private static final InvoiceService serviceInvoice = context.getBean("invoiceService", InvoiceService.class);

    private static final Guest guest = context.getBean("guest", Guest.class);
    private static final Address address = context.getBean("address", Address.class);
    private static final City city = context.getBean("city", City.class);

    public static ApplicationContext getContext() {
        return context;
    }

    public static Guest getGuest() {
        return guest;
    }

    public static Address getAddress() {
        return address;
    }

    public static City getCity() {
        return city;
    }

    public static GuestService getServiceGuest() {
        return serviceGuest;
    }

    public static CityService getServiceCity() {
        return serviceCity;
    }

    public static CountryService getServicecountry() {
        return serviceCountry;
    }

    public static AddressService getServiceAddress() {
        return serviceAddress;
    }

    public static ReservationService getServiceReservation() {
        return serviceReservation;
    }

    public static StayService getServiceStay() {
        return serviceStay;
    }

    public static InvoiceService getServiceInvoice() {
        return serviceInvoice;
    }

}
